﻿/// <reference path="jquery-1.3.1.js" />
function ClientProxyDateFormatted(methodName,serviceName, dto, successFunction, errorFunction) {
    $.ajax({
        type: "POST",
        url: serviceName + "/" + methodName,
        contentType: "application/json; charset=utf-8",
        data: JSON.stringify(dto),
        dataType: "json",
        processData: false,
        success: function(msgg) {
            var msg = JSON.parse(msgg, function(key, value) {
                var a;
                if (value != null) {
                    if (value.toString().indexOf('Date') >= 0) {
                        a = /^\/Date\((-?[0-9]+)\)\/$/.exec(value);
                        if (a) {
                            var dt = new Date(parseInt(a[1], 10));
                            return (dt.getMonth() + 1) + "/" + dt.getDate() + "/" + dt.getFullYear();
                        }
                    }
                    return value;
                }
            });
            successFunction(msg);
        },
        error: function(xhr, status, error) {
            errorFunction(xhr, status, error);
        }
    });
    return false;
}
